#!/usr/bin/python
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2011 zod.yslin
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 
# Author: zod.yslin
# Email: 
# File Name: t2.py
# Description: 
# 
# Edit History: 
#   2011-07-27    File created.
#===============================================================================
import urllib,urllib2
def get_html_through_proxy():
    url = 'http://dir.twseo.org/ip-check.php'
    user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
    values = {'chain' : ''}
    headers = { 'User-Agent' : user_agent }
    proxy = urllib2.ProxyHandler({'http': 'proxy.hinet.net:80'})
    opener = urllib2.build_opener(proxy)
    urllib2.install_opener(opener)
    data = urllib.urlencode(values)
    req = urllib2.Request(url, data, headers)
    response = urllib2.urlopen(req)
    the_page = response.read()

    print the_page

if __name__ == '__main__':
    get_html_through_proxy()
